A5Storage::DataItem Set Method

Syntax

.Set as L (Source as B, ContentType as C)

.Set as L (Source as C, ContentType as C)

.Set as L (Source as System::IO::Stream, ContentType as C)

Arguments

SourceBinary Character System::IO::Stream

The content to save in the item.

ContentTypeCharacter

The content type.

Returns

ResultLogical

Returns .T. if the operation succeeds, otherwise .F. (see .CallResult for additional error information.)

Description

Sets the object value and content type based on the values passed to the function.

Discussion

This function also accepts a stream. There may be some cases where a stream references the data from some other object that is the result of a .NET function call. You can pass the stream as the data argument.

Example

dim CallResult as CallResult
dim Container as A5Storage::DataContainer = null_value()

CallResult = A5Storage::DataContainer::Open(Container, "Provider='Disk';Container='c:\A5Webroot';")
if CallResult.Success
    dim Item A5Storage::DataItem = null_value()
    if Container.ReferenceItem(Item, "MyObjectName")
        dim Data as B = File.To_Blob("Myfile.jpg")
        dim ContentTypeResult as C = "image/jpg"
        if .not. Item.Set(Data, ContentType)
            showvar(Item.CallResult.Text, "Error in Set")
        end if
    end if
end if